---
- name: Install the httpd package, just to get the apache group on the system.
  package:
    pkg: httpd
    state: present
  tags:
  - packages
  - odcs
  - odcs/backend
- name: Make sure httpd isn't running.
  service:
    name: httpd
    state: stopped
    enabled: false
  tags:
  - odcs
  - odcs/backend
- name: generate the ODCS koji config
  template:
    src: etc/koji.conf.d/odcs.conf.j2
    dest: /etc/koji.conf.d/odcs.conf
    owner: odcs
    group: odcs
    mode: 0440
  notify:
  - restart odcs-backend
  tags:
  - odcs
  - odcs/backend
- name: add the odcs user to the apache group
  user:
    name: odcs
    group: apache
    groups: apache
    append: true
  notify:
  - restart odcs-backend
  tags:
  - odcs
  - odcs/backend
- name: migrate the database
  command: "{{ item }}"
  with_items:
  - odcs-manager upgradedb
  - odcs-manager db migrate
  become: yes
  become_user: odcs
  when: odcs_migrate_db
  tags:
  - odcs
  - odcs/backend

